# a, b, c = True, 2, "runoob"
# print(a, b, c)  # 输出: 1 2 runoob
# d= 3.14

# print("-----------------------------------------------------------------------------------")
# print(type(a))
# print(type(b))
# print(type(c))
# print(type(d))

# h=True
# print("h+b=",h+b)  # 输出: h+a= True
# print("h == 1", h == 1)  # 输出: h == 1 True
# print("h is 1", h is 1)  # 输出: h is True True
# print("1 is h", 1 is h)  # 输出: h is True True

# print("------------------------------------------------------------------------------------")

# print("5+4=",5+4)  # 输出: 5+4
# print("5-4=",5-4)  # 输出: 5+4
# print("5*4=",5*4)  # 输出: 5+4
# print("5**4=",5**4)  # 输出: 5+4
# print("5/4=",5/4)  # 输出: 5+4
# print("5//4=",5//4)  # 输出: 5+4
# print("5%4=",5%4)  # 输出: 5+4


# print("-----------------------------------------------------------------------------------")

# #!/usr/bin/python3

# str = 'Runoob'  # 定义一个字符串变量

# print(str)           # 打印整个字符串
# print(str[0:-1])     # 打印字符串第一个到倒数第二个字符（不包含倒数第一个字符）
# print(str[0])        # 打印字符串的第一个字符
# print(str[2:5])      # 打印字符串第三到第五个字符（不包含索引为 5 的字符）
# print(str[2:])       # 打印字符串从第三个字符开始到末尾
# print(str * 2)       # 打印字符串两次
# print(2*(str + "TEST"))  # 打印字符串和"TEST"拼接在一起



# print("-----------------------------------------------------------------------------------")

# # 布尔类型的值和类型
# a = True
# b = False
# print(type(a))  # <class 'bool'>
# print(type(b))  # <class 'bool'>

# # 布尔类型的整数表现
# print(int(True))   # 1
# print(int(False))  # 0

# # 使用 bool() 函数进行转换
# print(bool(0))         # False
# print(bool(42))        # True
# print(bool(''))        # False
# print(bool('Python'))  # True
# print(bool([]))        # False
# print(bool([1, 2, 3])) # True

# # 布尔逻辑运算
# print(True and False)  # False
# print(True or False)   # True
# print(not True)        # False

# # 布尔比较运算
# print(5 > 3)  # True
# print(2 == 2) # True
# print(7 < 4)  # False

# # 布尔值在控制流中的应用
# if True:
#     print("This will always print")
    
# if not False:
#     print("This will also always print")
    
# x = 10
# if x:
#     print("x is non-zero and thus True in a boolean context")

# print("-----------------------------------------------------------------------------------")

# #list列表

# lost1=[True,2,3.1415926726,"runoob"]
# lost2=[True,2,3.1415926726,"runoob"]
# print(lost1)  # 输出: [True, 2, 3.1415926726, 'runoob']
# print(type(lost1))  # 输出: <class 'list'>  
# print(lost1[0])  # 输出: True
# print(lost1[1])  # 输出: 2
# print(lost1[2:])  # 输出: 3.1415926726
# print(lost1[1:3])  # 输出: 3.1415926726
# print(lost1[1:-1])  # 输出: 3.1415926726
# print(lost1+lost2)  # 输出: [True, 2, 3.1415926726, 'runoob', True, 2, 3.1415926726, 'runoob']

# lost1[2] = 3.1415926726  # 修改列表中的第三个元素
# lost1[-1] = "rudsadasnoob"  # 修改列表中的最后一个元素   


# print(type(lost1))  # 输出: <class 'list'>  
# print(lost1[0])  # 输出: True
# print(lost1[1])  # 输出: 2
# print(lost1[2:])  # 输出: 3.1415926726
# print(lost1[1:3])  # 输出: 3.1415926726x
# print(lost1[1:-1])  # 输出: 3.1415926726


# print("-----------------------------------------------------------------------------------")# list 列表

# def reverse_list(lst):
#     """反转列表"""
#     return lst[::-1]
# lost1 = [True, 2, 3.1415926726, "runoob"]
# lost2 = [True, 2, 3.1415926726, "runoob"]
# print(lost1)  # 输出: [True, 2, 3.1415926726, 'runoob']
# print(type(lost1))  # 输出: <class 'list'>          
# print(reverse_list(lost1))  # 输出: ['runoob', 3.1415926726, 2, True]




# def reverse_string(input):
#     inputWords=input.split(" ")
#     inputWords=inputWords[::-1]
#     return ' '.join(inputWords) 

# # output="dsad dasdw dwrgc gdfgdf"
# # return reverse_string(output)  # 输出: gdfgdf dwrgc dasdw dsad

# input=  'I like runoob'
# rw= reverse_string(input)
# print(rw)  # 输出: runoob like I    



# #!/usr/bin/python3

# tuple = ( 'abcd', 786 , 2.23, 'runoob', 70.2  )
# tinytuple = (123, 'runoob')

# print (tuple)             # 输出完整元组
# print (tuple[0])          # 输出元组的第一个元素
# print (tuple[1:-1])        # 输出从第二个元素开始到第三个元素
# print (tuple[2:])         # 输出从第三个元素开始的所有元素
# print (tinytuple * 2)     # 输出两次元组
# print (tuple + tinytuple) # 连接元组

# print(tuple[::-1]) # 输出元组的逆序: ('runoob', 70.2, 2.23, 786, 'abcd')



# tuple = (1, 2, 3, [2,3.1483921,"nihao hello woeld"], 5)
# print(tuple)  # 输出: (1, 2, 3, [2, 3.1483921, 'nihao hello woeld'], 5)
# print(type(tuple))  # 输出: <class 'tuple'> 
# tuple[3].append("runoob")  # 修改元组中的列表元素
# print(tuple)  # 输出: (1, 2, 3, [2, 3.1483921, 'nihao hello woeld', 'runoob'], 5)
# print(tuple*2)  # 输出: (1, 2, 3, [2, 3.1483921, 'nihao hello woeld', 'runoob'], 5, 1, 2, 3, [2, 3.1483921, 'nihao hello woeld', 'runoob'], 5)

# print(tuple[::-1]) # 输出元组的逆序: (5, [2, 3.1483921, 'nihao hello woeld', 'runoob'], 3, 2, 1)

# print("-----------------------------------------------------------------------------------")

# #!/usr/bin/python3

# sites = {'Google', 'Taobao', 'Runoob', 'Facebook', 'Zhihu', 'Baidu'}

# print(sites)   # 输出集合，重复的元素被自动去掉

# # 成员测试
# if 'Runoob' in sites :
#     print('Runoob 在集合中')
# else :
#     print('Runoob 不在集合中')


# # set可以进行集合运算
# a = set('abcefghijklmnobqrstuvwxyz')
# b = set('klmnobqrstuvwx')

# print(a)

# print(a - b)     # a 和 b 的差集

# print(a | b)     # a 和 b 的并集

# print(a & b)     # a 和 b 的交集

# print(a ^ b)     # a 和 b 中不同时存在的元素



# print("-----------------------------------------------------------------------------------")

# #!/usr/bin/python3

# dict3 = {}
# dict3['one'] = "1 - 菜鸟教程"
# dict3[2]     = "2 - 菜鸟工具"

# tinydict = {'name': 'runoob','code':1, 'site': 'www.runoob.com'}


# print (dict3['one'])       # 输出键为 'one' 的值
# print (dict3[2])           # 输出键为 2 的值
# print (tinydict)          # 输出完整的字典
# print (tinydict.keys())   # 输出所有键
# print (tinydict.values()) # 输出所有值

# dict2=dict([("nihao","hello world"),("nihao2","hello world2")])

# print(dict2)


print("-----------------------------------------------------------------------------------")    
# x = b"hello"
# y = x[1:3]  # 切片操作，得到 b"el"
# z = x + b"world"  # 拼接操作，得到 b"helloworld"
# print(x)  # 输出: b'hello'
# print(y)  # 输出: b'el'     
# print(z)  # 输出: b'helloworld'
# print(type(x)); # 输出: <class 'bytes'>

x = b"hello world"
y=x[1:5]
z=y+b"world"
print(x)  # 输出: b'hello world'
print(y)  # 输出: b'ello'       
print(z)  # 输出: b'elloworld'
print(type(x))  # 输出: <class 'bytes'>
print(type(y))  # 输出: <class 'bytes'>
print(type(z))  # 输出: <class 'bytes'>